<template>
	<view class="pageHead" :style="{paddingTop:statusBarHeight + 'px'}" >
		<!-- <view class="header_bar header_fixed" :style="{paddingTop:headerBarTop + 'px',height:headerBarHeight + 'px'}"> -->
		<view class="header_bar header_fixed" :style="{paddingTop:statusBarHeight + 'px'}">
			<view class="header">
				<view v-if="back == 0 && backShow==true" class="header-back" @click="backPage()">
					<image class="ico" :src="IMAGE_STATIC+'/images/return.png'" mode="widthFix"/>
				</view>
				<view  v-if="back != 0 && backShow" class="header-back--white" @click="backPage()">
					<image class="ico" :src="IMAGE_STATIC+'/images/return--white.png'" mode="widthFix"/>
				</view>
				<view v-if="back == 0 " class="header-title" ><slot> </slot></view>
				<view v-else class="header-title--white" ><slot> </slot></view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props:{
			back:{
				type: [Number, String],
				default: 0,
			},
			backShow:{
				type:Boolean,
				default:true
			},
			pagesPath:{
				type:String,
				default:''
			}
		},
		data(){
			return{
				IMAGE_STATIC: this.$url.assetsPath, // 静态图片地址
				headerTitle: "",
				headerBarTop: 0,   //搜索栏的外边框高度，单位px
				headerBarHeight: 0,  //搜索栏的高度，单位px
				statusBarHeight:0,
				// pagesPath:''
			}
		},
		mounted() {
			// #ifndef H5
			// let menuButtonInfo = uni.getMenuButtonBoundingClientRect();
			// this.headerBarTop = menuButtonInfo.top;
			// this.headerBarHeight = menuButtonInfo.height;
			 //获取手机型号
			 const that = this
			 uni.getSystemInfo({
				success: function (res) {
				that.statusBarHeight = res.statusBarHeight//状态栏高度
				that.platform = res.platform//机型
				console.log('platform',that.platform ,',statusBarHeight',that.statusBarHeight)
				}
			});
			// #endif 
			// console.log("headerBarTop:",this.headerBarTop);
			// this.pagesPath = this.backMethod
			console.log('backMethod 00',this.pagesPath)
		},
		methods:{
			backPage(){
				// if(this.$listeners['backMethod']){
				if(this.pagesPath){
					console.log('父组件传了方法')
					this.$tools.jump(this.pagesPath)
					// this.$emit('backMethod')
				}else{
					this.$tools.back(1)
					// uni.navigateBack({
					// 	delta: 1
					// })
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	@import '@/common/scss/style.css';
	.pageHead{
		width: 100%;
		/*  #ifdef H5 || APP-PLUS  */
		padding-bottom: 88rpx;
		/*  #endif   */
		/*  #ifdef MP-WEIXIN  */
		// padding-bottom: 88rpx;
		padding-bottom: 0rpx;
		/*  #endif   */
	}
</style>